
********************************
********************************
**Baseline Results
********************************
********************************
use risk_insurance_models, clear
*Property Rights
eststo clear
eststo: xi: reg govrisk  leg ln_gdppc_9502 i.ht_region , vce(ro)
eststo: xi: reg govrisk  lparty2 ln_gdppc_9502 i.ht_region , vce(ro)
*missing trade for Iraq, one observation dropped from full controls model*
eststo: xi: reg govrisk  lparty2 ln_gdppc_9502 i.ht_region gdppcg_9502  ln_pop_9502  trade_9502  oildummy  , vce(ro)
eststo: xi: reg govrisk  lparty2 ln_gdppc_9502 i.ht_region i.lp_leg  wbgi_rle gdppcg_9502  ln_pop_9502  trade_9502  oildummy  , vce(ro)

*Investor Protection
eststo: xi: reg investor_2006  leg ln_gdppc_9502 i.ht_region , vce(ro)
eststo: xi: reg investor_2006  lparty2 ln_gdppc_9502 i.ht_region , vce(ro)
*missing trade for Iraq, one observation dropped from full controls model*
eststo: xi: reg investor_2006  lparty2 ln_gdppc_9502 i.ht_region gdppcg_9502  ln_pop_9502  trade_9502  oildummy  , vce(ro)
eststo: xi: reg investor_2006  lparty2 ln_gdppc_9502 i.ht_region i.lp_leg  wbgi_rle gdppcg_9502  ln_pop_9502  trade_9502  oildummy  , vce(ro)

esttab using baseline.csv, replace  label star(* 0.10 ** 0.05 *** 0.01) nomtitles  noconstant  scalars (r2 N) sfmt(%9.3f %9.0f) nomtitles se(3) b(3) 

*controlling for years in office and history of democracy
eststo: xi: reg investor_2006  lparty2  democracy_yr ln_gdppc_9502 i.ht_region , vce(ro)
eststo: xi: reg investor_2006  lparty2   dpi_yio ln_gdppc_9502 i.ht_region , vce(ro)
eststo: xi: reg investor_2006  lparty2  democracy_yr ln_gdppc_9502 i.ht_region gdppcg_9502  ln_pop_9502  trade_9502  oildummy  , vce(ro)
eststo: xi: reg investor_2006  lparty2  dpi_yio ln_gdppc_9502 i.ht_region gdppcg_9502  ln_pop_9502  trade_9502  oildummy  , vce(ro)
*****************************
*****************************
**Robustness: IV Models
*****************************
*****************************
*missing inherit for Lebanon, one more observation dropped from two-stage model*
eststo clear
est drop f*
eststo: xi: ivreg2 govrisk   ln_gdppc_9502 i.ht_region (leg = inherit_1996 ),  first ro savefprefix(f1)
eststo: xi: ivreg2 govrisk   ln_gdppc_9502 gdppcg_9502  ln_pop_9502  trade_9502  oildummy i.ht_region i.lp_leg wbgi_rle (leg = inherit_1996 ),  first ro savefprefix(f2)
eststo: xi: ivreg2 govrisk   ln_gdppc_9502 i.ht_region (lparty2 = inherit_1996 ),  first ro savefprefix(f3)
eststo: xi: ivreg2 govrisk   ln_gdppc_9502 gdppcg_9502  ln_pop_9502  trade_9502  oildummy i.ht_region i.lp_leg wbgi_rle (lparty2 = inherit_1996 ),  first ro savefprefix(f4)

eststo: xi: ivreg2 investor_2006   ln_gdppc_9502 i.ht_region (leg = inherit_1996 ),  first ro savefprefix(f5)
eststo: xi: ivreg2 investor_2006   ln_gdppc_9502 gdppcg_9502  ln_pop_9502  trade_9502  oildummy i.ht_region i.lp_leg wbgi_rle (leg = inherit_1996 ),  first ro savefprefix(f6)
eststo: xi: ivreg2 investor_2006   ln_gdppc_9502 i.ht_region (lparty2 = inherit_1996 ),  first ro savefprefix(f7)
eststo: xi: ivreg2 investor_2006   ln_gdppc_9502 gdppcg_9502  ln_pop_9502  trade_9502  oildummy i.ht_region i.lp_leg wbgi_rle (lparty2 = inherit_1996 ),  first ro savefprefix(f8)

esttab using robust.csv, replace  label star(* 0.10 ** 0.05 *** 0.01)  nomtitles noconstant se(3) b(3)  scalars(N r2 idstat idp rkf cdf) sfmt(%9.0f %9.3f %9.3f %9.3f %9.3f %9.3f)
esttab f* using first.csv, replace label star(* 0.10 ** 0.05 *** 0.01)  nomtitles se(3) b(3) scalars(N) sfmt(%9.0f %9.3f %9.3f %9.3f)


****************************************
****************************************
****************************************
*Online Appendix 
****************************************
****************************************
use risk_insurance_models, clear
*********
*Correlation Table
*********************
pwcorr  govrisk investor_2006 leg lparty2 inherit_1996 ln_gdppc_9502  gdppcg_9502  ln_pop_9502  trade_9502 wbgi_rle oildummy,  star(1) 

****************
*Summary Stats
*******************
tabstat govrisk if ln_gdppc_9502 !=.,  stat(n mean sd min max) col(stat) va(16)
tabstat govrisk investor_2006 leg lparty2 inherit_1996 ln_gdppc_9502  gdppcg_9502  ln_pop_9502  trade_9502 wbgi_rle oildummy if investor_2006!=.&ln_gdppc_9502 !=.,  stat(n mean sd min max) col(stat) va(16)

************************
*Baseline Models
************************
*Property Rights (Ordered Probit) 
**:: Note: govrisk needs to be rounded for continuous (imputed) values:
tab govrisk
replace govrisk = 2 if govrisk>=1.5&govrisk<2.5
replace govrisk = 3 if govrisk>=2.5&govrisk<3.5
replace govrisk = 4 if govrisk>=3.5&govrisk<4.5
replace govrisk = 5 if govrisk>=4.5&govrisk<5.5
replace govrisk = 6 if govrisk>=5.5&govrisk<6.5
replace govrisk = 7 if govrisk>=6.5&govrisk<7.5

eststo clear
eststo: xi: oprobit govrisk  leg ln_gdppc_9502 i.ht_region , vce(ro)
eststo: xi: oprobit govrisk  lparty2 ln_gdppc_9502 i.ht_region , vce(ro)
eststo: xi: oprobit govrisk  lparty2 ln_gdppc_9502 i.ht_region gdppcg_9502  ln_pop_9502  trade_9502  oildummy  , vce(ro)
eststo: xi: oprobit govrisk  lparty2 ln_gdppc_9502 i.ht_region i.lp_leg  wbgi_rle gdppcg_9502  ln_pop_9502  trade_9502  oildummy  , vce(ro)


*Investor Protection (Tobit)
eststo: xi: tobit investor_2006  leg ln_gdppc_9502 i.ht_region , ll ul vce(ro)
eststo: xi: tobit investor_2006  lparty2 ln_gdppc_9502 i.ht_region , ll ul vce(ro)
eststo: xi: tobit investor_2006  lparty2 ln_gdppc_9502 i.ht_region gdppcg_9502  ln_pop_9502  trade_9502  oildummy  , ll ul vce(ro)
eststo: xi: tobit investor_2006  lparty2 ln_gdppc_9502 i.ht_region i.lp_leg  wbgi_rle gdppcg_9502  ln_pop_9502  trade_9502  oildummy  , ll ul vce(ro)

esttab using appendix_baseline.csv, replace  label star(* 0.10 ** 0.05 *** 0.01) nomtitles  noconstant  scalars (r2_p N) sfmt(%9.3f %9.0f) nomtitles se(3) b(3) 

**************
*Alternative Property Rights Measures
**************************************
use risk_insurance_models, clear
eststo clear
eststo: xi: reg gcr  leg ln_gdppc_9502 i.ht_region , vce(ro)
eststo: xi: reg gcr  lparty2 ln_gdppc_9502 i.ht_region , vce(ro)

eststo: xi: reg hf_prights  leg ln_gdppc_9502 i.ht_region , vce(ro)
eststo: xi: reg hf_prights  lparty2 ln_gdppc_9502 i.ht_region , vce(ro)

eststo: xi: reg fi_legprop  leg ln_gdppc_9502 i.ht_region , vce(ro)
eststo: xi: reg fi_legprop lparty2 ln_gdppc_9502 i.ht_region , vce(ro)

esttab using alt_dvs.csv, replace  label star(* 0.10 ** 0.05 *** 0.01) nomtitles  noconstant  scalars (r2 N) sfmt(%9.3f %9.0f) nomtitles se(3) b(3) 


**********************
*Two Stage Models w/ Regional and Legal Origin Dummies
**********************
use risk_insurance_models, clear
*****************
*Property Rights
*first-stage models
*Note regional and legal origin dummies perfectly predict the DV in some cases, resulting
*in a smaller sample than the 2SLS models

eststo clear
eststo: xi:probit leg inherit_1996 ln_gdppc_9502 i.ht_region if govrisk!=., vce(ro)
predict pred1
eststo:xi: probit leg inherit_1996 ln_gdppc_9502 gdppcg_9502  ln_pop_9502  trade_9502  oildummy i.ht_region i.lp_leg wbgi_rle  if govrisk!=., vce(ro)
predict pred2
eststo: xi:probit lparty2 inherit_1996 ln_gdppc_9502 i.ht_region if govrisk!=., vce(ro)
predict pred3
eststo:xi: probit lparty2 inherit_1996 ln_gdppc_9502 gdppcg_9502  ln_pop_9502  trade_9502  oildummy i.ht_region i.lp_leg wbgi_rle  if govrisk!=., vce(ro)
predict pred4


*second-stage models
replace govrisk = 2 if govrisk>=1.5&govrisk<2.5
replace govrisk = 3 if govrisk>=2.5&govrisk<3.5
replace govrisk = 4 if govrisk>=3.5&govrisk<4.5
replace govrisk = 5 if govrisk>=4.5&govrisk<5.5
replace govrisk = 6 if govrisk>=5.5&govrisk<6.5
replace govrisk = 7 if govrisk>=6.5&govrisk<7.5
eststo: xi:oprobit govrisk  pred1 ln_gdppc_9502 i.ht_region,  vce(bootstrap, reps(500))
eststo: xi:oprobit govrisk  pred2 ln_gdppc_9502 gdppcg_9502  ln_pop_9502  trade_9502  oildummy i.ht_region i.lp_leg wbgi_rle  ,  vce(bootstrap, reps(500))
eststo: xi:oprobit govrisk  pred3 ln_gdppc_9502 i.ht_region,  vce(bootstrap, reps(500))
eststo: xi:oprobit govrisk  pred4 ln_gdppc_9502 gdppcg_9502  ln_pop_9502  trade_9502  oildummy i.ht_region i.lp_leg wbgi_rle  ,  vce(bootstrap, reps(500))

drop pred1-pred4 

*********************
*Investor Protection
*first-stage models

eststo: xi:probit leg inherit_1996 ln_gdppc_9502 i.ht_region if investor_2006!=., vce(ro)
predict pred1
eststo:xi: probit leg inherit_1996 ln_gdppc_9502 gdppcg_9502  ln_pop_9502  trade_9502  oildummy i.ht_region i.lp_leg wbgi_rle  if investor_2006!=., vce(ro)
predict pred2
eststo: xi:probit lparty2 inherit_1996 ln_gdppc_9502 i.ht_region if investor_2006!=., vce(ro)
predict pred3
eststo:xi: probit lparty2 inherit_1996 ln_gdppc_9502 gdppcg_9502  ln_pop_9502  trade_9502  oildummy i.ht_region i.lp_leg wbgi_rle  if investor_2006!=., vce(ro)
predict pred4

*second-stage models
eststo: xi:tobit investor_2006  pred1 ln_gdppc_9502 i.ht_region, ll ul vce(bootstrap, reps(500))
eststo: xi:tobit investor_2006  pred2 ln_gdppc_9502 gdppcg_9502  ln_pop_9502  trade_9502  oildummy i.ht_region i.lp_leg wbgi_rle  ,  ll ul vce(bootstrap, reps(500))
eststo: xi:tobit investor_2006  pred3 ln_gdppc_9502 i.ht_region, ll ul vce(bootstrap, reps(500))
eststo: xi:tobit investor_2006  pred4 ln_gdppc_9502 gdppcg_9502  ln_pop_9502  trade_9502  oildummy i.ht_region i.lp_leg wbgi_rle  , ll ul  vce(bootstrap, reps(500))

esttab using appendix_robust1.csv, replace  label star(* 0.10 ** 0.05 *** 0.01) nomtitles  noconstant  scalars (r2_p N) sfmt(%9.3f %9.0f) nomtitles se(3) b(3) 


**********************
*Two Stage Models WITHOUT Regional and Legal Origin Dummies
**********************
use risk_insurance_models, clear
*****************
*Property Rights
*first-stage models

eststo clear
eststo: xi:probit leg inherit_1996 ln_gdppc_9502  if govrisk!=., vce(ro)
predict pred1
eststo:xi: probit leg inherit_1996 ln_gdppc_9502 gdppcg_9502  ln_pop_9502  trade_9502  oildummy   wbgi_rle  if govrisk!=., vce(ro)
predict pred2
eststo: xi:probit lparty2 inherit_1996 ln_gdppc_9502  if govrisk!=., vce(ro)
predict pred3
eststo:xi: probit lparty2 inherit_1996 ln_gdppc_9502 gdppcg_9502  ln_pop_9502  trade_9502  oildummy   wbgi_rle  if govrisk!=., vce(ro)
predict pred4


*second-stage models
replace govrisk = 2 if govrisk>=1.5&govrisk<2.5
replace govrisk = 3 if govrisk>=2.5&govrisk<3.5
replace govrisk = 4 if govrisk>=3.5&govrisk<4.5
replace govrisk = 5 if govrisk>=4.5&govrisk<5.5
replace govrisk = 6 if govrisk>=5.5&govrisk<6.5
replace govrisk = 7 if govrisk>=6.5&govrisk<7.5
eststo: xi:oprobit govrisk  pred1 ln_gdppc_9502 ,  vce(bootstrap, reps(500))
eststo: xi:oprobit govrisk  pred2 ln_gdppc_9502 gdppcg_9502  ln_pop_9502  trade_9502  oildummy   wbgi_rle  ,  vce(bootstrap, reps(500))
eststo: xi:oprobit govrisk  pred3 ln_gdppc_9502 ,  vce(bootstrap, reps(500))
eststo: xi:oprobit govrisk  pred4 ln_gdppc_9502 gdppcg_9502  ln_pop_9502  trade_9502  oildummy   wbgi_rle  ,  vce(bootstrap, reps(500))

drop pred1-pred4 

*********************
*Investor Protection
*first-stage models

eststo: xi:probit leg inherit_1996 ln_gdppc_9502  if investor_2006!=., vce(ro)
predict pred1
eststo:xi: probit leg inherit_1996 ln_gdppc_9502 gdppcg_9502  ln_pop_9502  trade_9502  oildummy   wbgi_rle  if investor_2006!=., vce(ro)
predict pred2
eststo: xi:probit lparty2 inherit_1996 ln_gdppc_9502  if investor_2006!=., vce(ro)
predict pred3
eststo:xi: probit lparty2 inherit_1996 ln_gdppc_9502 gdppcg_9502  ln_pop_9502  trade_9502  oildummy   wbgi_rle  if investor_2006!=., vce(ro)
predict pred4

*second-stage models
eststo: xi:tobit investor_2006  pred1 ln_gdppc_9502 , ll ul vce(bootstrap, reps(500))
eststo: xi:tobit investor_2006  pred2 ln_gdppc_9502 gdppcg_9502  ln_pop_9502  trade_9502  oildummy   wbgi_rle  ,  ll ul vce(bootstrap, reps(500))
eststo: xi:tobit investor_2006  pred3 ln_gdppc_9502 , ll ul vce(bootstrap, reps(500))
eststo: xi:tobit investor_2006  pred4 ln_gdppc_9502 gdppcg_9502  ln_pop_9502  trade_9502  oildummy   wbgi_rle  , ll ul  vce(bootstrap, reps(500))

esttab using appendix_robust2.csv, replace  label star(* 0.10 ** 0.05 *** 0.01) nomtitles  noconstant  scalars (r2_p N) sfmt(%9.3f %9.0f) nomtitles se(3) b(3) 

****************************
**Wright Replications
****************************
gen wright = .
replace wright = 1 if wr_mir == 1
replace wright = 2 if wr_mor == 1
replace wright = 3 if wr_mpr == 1
replace wright = 4 if wr_pr  == 1
replace wright = 5 if wr_spr == 1
replace wright = 6 if wr_mir==0 &wr_mor==0&wr_mpr==0&wr_pr ==0&wr_spr==0

foreach v of varlist wr_mir wr_mor wr_mpr wr_pr wr_spr{
	gen `v'_leg = `v'*leg
	}
eststo clear
eststo: xi: oprobit govrisk wr_mir leg  wr_mir_leg ln_gdppc_9502 i.ht_region , vce(ro)
eststo: xi: oprobit govrisk wr_mor leg  wr_mor_leg ln_gdppc_9502 i.ht_region , vce(ro)
eststo: xi: oprobit govrisk wr_mpr leg  wr_mpr_leg ln_gdppc_9502 i.ht_region , vce(ro)
eststo: xi: oprobit govrisk wr_pr leg   wr_pr_leg ln_gdppc_9502 i.ht_region , vce(ro)
eststo: xi: oprobit govrisk wr_spr leg   wr_spr_leg ln_gdppc_9502 i.ht_region , vce(ro)

eststo: xi: tobit investor_2006 wr_mir leg  wr_mir_leg  ln_gdppc_9502 i.ht_region , ll ul vce(ro)
eststo: xi: tobit investor_2006 wr_mor leg  wr_mor_leg  ln_gdppc_9502 i.ht_region , ll ul vce(ro)
eststo: xi: tobit investor_2006 wr_mpr leg  wr_mpr_leg  ln_gdppc_9502 i.ht_region , ll ul vce(ro)
eststo: xi: tobit investor_2006 wr_pr leg   wr_pr_leg   ln_gdppc_9502 i.ht_region , ll ul vce(ro)
eststo: xi: tobit investor_2006 wr_spr leg   wr_spr_leg   ln_gdppc_9502 i.ht_region , ll ul vce(ro)

esttab using appendix_wright.csv, replace  label star(* 0.10 ** 0.05 *** 0.01) nomtitles  noconstant pr2 scalars (N) sfmt(%9.0f) nomtitles se(3) b(3) 













